dccp: don't duplicate ccid when cloning dccp sock
authorLin, Zhenpeng <zplin@psu.edu>
Wed, 8 Sep 2021 03:40:59 +0000 (03:40 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 23 Sep 2021 20:35:21 +0000 (21:35 +0100)
commitaafb0cbaf0dd7474d93fe29cab0041be06581c15
tree27ccd18bdcb64ea84eaa82dcb399dba6ffc388e4
parent390f810e7829fb13c37c6f0dd9430ff27072ca79
dccp: don't duplicate ccid when cloning dccp sock

Origin: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=6c3cb65d561e76fd0398026c023e587fec70e188
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2020-16119

commit d9ea761fdd197351890418acd462c51f241014a7 upstream.

Commit 2677d2067731 ("dccp: don't free ccid2_hc_tx_sock ...") fixed
a UAF but reintroduced CVE-2017-6074.

When the sock is cloned, two dccps_hc_tx_ccid will reference to the
same ccid. So one can free the ccid object twice from two socks after
cloning.

This issue was found by "Hadar Manor" as well and assigned with
CVE-2020-16119, which was fixed in Ubuntu's kernel. So here I port
the patch from Ubuntu to fix it.

The patch prevents cloned socks from referencing the same ccid.

Fixes: 2677d2067731410 ("dccp: don't free ccid2_hc_tx_sock ...")
Signed-off-by: Zhenpeng Lin <zplin@psu.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name dccp-don-t-duplicate-ccid-when-cloning-dccp-sock.patch
net/dccp/minisocks.c